<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

class TRealdataSingle extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('t_realdata_single', function (Blueprint $table) {
             $table->engine = 'MEMORY';
             $table->charset = 'utf8';
             $table->collation = 'utf8_general_ci';
            // CONTENT
            $table->datetime('rd_updatetime')->nullable(false)->comment('');
			$table->unsignedInteger('pdi_index')->nullable(false)->default(0)->comment('');
			$table->string('rd_upsmanuinfo', 25)->nullable()->default('')->comment('');
			$table->string('rd_upsmactype', 25)->nullable()->default('')->comment('');
			$table->string('rd_upsver', 25)->nullable()->default('')->comment('');
			$table->string('rd_upsvolr', 25)->nullable()->default('')->comment('');
			$table->string('rd_upscurr', 25)->nullable()->default('')->comment('');
			$table->string('rd_upsbatvolr', 25)->nullable()->default('')->comment('');
			$table->string('rd_upsfreqr', 25)->nullable()->default('')->comment('');
			$table->float('rd_upsinvol', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_upsdefvol', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_upsoutvol', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_upscurload', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_upsinfreq', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_ups1batvol', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_upstemp', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_BattCap', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_OutMaxVol', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_OutMinVol', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_BatTemp', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_BatAllVol', 9, 2)->nullable()->default(0)->comment('');
			$table->float('rd_ReTime', 9, 2)->nullable()->default(0)->comment('');
			$table->boolean('rd_upssound')->nullable()->default(0)->comment('');
			$table->boolean('rd_upspoweroff')->nullable()->default(0)->comment('');
			$table->boolean('rd_upstest')->nullable()->default(0)->comment('');
			$table->boolean('rd_upsfailstat')->nullable()->default(0)->comment('');
			$table->boolean('rd_upsbypassstat')->nullable()->default(0)->comment('');
			$table->boolean('rd_upsbatvollow')->nullable()->default(0)->comment('');
			$table->boolean('rd_upsacfail')->nullable()->default(0)->comment('');
			$table->boolean('rd_LoadAlarm')->nullable()->default(0)->comment('');
			$table->boolean('rd_upsdisconn')->nullable()->default(0)->comment('');
			$table->boolean('rd_NetCom')->nullable()->default(0)->comment('');
			$table->unique('pdi_index', 'pdi_index');
			
        });

        
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('t_realdata_single');
    }
}
